import re


def sanitize_table_name(lottery_code: str) -> str:
    """
    将彩票代码转换为安全的表名
    :param lottery_code:
    :return:
    """
    table_name = re.sub(r"[^a-zA-Z0-9]", "_", lottery_code).lower()
    if not table_name[0].isalpha():
        table_name = "t_" + table_name
    return table_name


def format_open_number(open_number: str) -> str:
    """
    格式化开奖号码，去除逗号和空格
    :param open_number: 
    :return: 
    """
    if not open_number:
        return ""
    return open_number.replace(",", "").replace(" ", "")
